package fr.thelem.gestiondemandesthelem.dao.model;

import static javax.persistence.CascadeType.PERSIST;

import java.io.Serializable;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;

import javax.persistence.Column;
import javax.persistence.ElementCollection;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;

/**
 * Entity implementation class for Entity: PointDeControleEntity
 * 
 */
@Entity
@Table(name = "CD_POINT_DE_CONTROLE")
public class CDPointDeControleEntity implements Serializable {

    private static final long serialVersionUID = 1L;

    @Id
    @Column(nullable = false, name = "IDENTIFIANT_CD_POINT_DE_CONTROLE")
    @GeneratedValue
    private int identifiantCDPointDeControle;

    @Column(name = "NOM_CD_POINT_DE_CONTROLE", unique = true)
    private String nomCDPointDeControle;

    @Column(name = "TYPE_SAISIE_CD_POINT_DE_CONTROLE")
    private String typeSaisieCDPointDeControle;

    @ElementCollection
    private Map<CDDemandeEntity, Integer> numeroCDPointDeControle;

    @ManyToMany(cascade = {PERSIST}, mappedBy = "CDPointsDeControleCDDemande")
    private Collection<CDDemandeEntity> CDDemandesCDPointControle;
    
    @OneToMany(mappedBy = "CDPointControleCPPointControle")
    private Collection<CPPointDeControleEntity> CPPointControlesCDPointControle;

    /**
     * Constructeur
     */
    public CDPointDeControleEntity() {
        super();
        this.numeroCDPointDeControle = new HashMap<CDDemandeEntity, Integer>();
        this.CDDemandesCDPointControle = new HashSet<CDDemandeEntity>();
    }

    /**
     * Accesseur de identifiantCDPointDeControle
     * 
     * @return le identifiantCDPointDeControle
     */
    public int getIdentifiantCDPointDeControle() {
        return identifiantCDPointDeControle;
    }

    /**
     * Affectation de identifiantCDPointDeControle
     * 
     * @param identifiantCDPointDeControle identifiantCDPointDeControle à affecter
     */
    public void setIdentifiantCDPointDeControle(int identifiantCDPointDeControle) {
        this.identifiantCDPointDeControle = identifiantCDPointDeControle;
    }

    /**
     * Accesseur de nomCDPointDeControle
     * 
     * @return le nomCDPointDeControle
     */
    public String getNomCDPointDeControle() {
        return nomCDPointDeControle;
    }

    /**
     * Affectation de nomCDPointDeControle
     * 
     * @param nomCDPointDeControle nomCDPointDeControle à affecter
     */
    public void setNomCDPointDeControle(String nomCDPointDeControle) {
        this.nomCDPointDeControle = nomCDPointDeControle;
    }

    /**
     * Accesseur de typeSaisieCDPointDeControle
     * 
     * @return le typeSaisieCDPointDeControle
     */
    public String getTypeSaisieCDPointDeControle() {
        return typeSaisieCDPointDeControle;
    }

    /**
     * Affectation de typeSaisieCDPointDeControle
     * 
     * @param typeSaisieCDPointDeControle typeSaisieCDPointDeControle à affecter
     */
    public void setTypeSaisieCDPointDeControle(String typeSaisieCDPointDeControle) {
        this.typeSaisieCDPointDeControle = typeSaisieCDPointDeControle;
    }

    /**
     * Accesseur de numeroCDPointDeControle
     * 
     * @return le numeroCDPointDeControle
     */
    public Map<CDDemandeEntity, Integer> getNumeroCDPointDeControle() {
        return numeroCDPointDeControle;
    }

    /**
     * Affectation de numeroCDPointDeControle
     * 
     * @param numeroCDPointDeControle numeroCDPointDeControle à affecter
     */
    public void setNumeroCDPointDeControle(Map<CDDemandeEntity, Integer> numeroCDPointDeControle) {
        this.numeroCDPointDeControle = numeroCDPointDeControle;
    }

    /**
     * Accesseur de cDDemandesCDPointControle
     * 
     * @return le cDDemandesCDPointControle
     */
    public Collection<CDDemandeEntity> getCDDemandesCDPointControle() {
        return CDDemandesCDPointControle;
    }

    /**
     * Affectation de cDDemandesCDPointControle
     * 
     * @param cDDemandesCDPointControle cDDemandesCDPointControle à affecter
     */
    public void setCDDemandesCDPointControle(Collection<CDDemandeEntity> cDDemandesCDPointControle) {
        CDDemandesCDPointControle = cDDemandesCDPointControle;
    }

    /**
     * Accesseur de cPPointControlesCDPointControle
     * 
     * @return le cPPointControlesCDPointControle
     */
    public Collection<CPPointDeControleEntity> getCPPointControlesCDPointControle() {
        return CPPointControlesCDPointControle;
    }

    /**
     * Affectation de cPPointControlesCDPointControle
     * 
     * @param cPPointControlesCDPointControle cPPointControlesCDPointControle à affecter
     */
    public void setCPPointControlesCDPointControle(Collection<CPPointDeControleEntity> cPPointControlesCDPointControle) {
        CPPointControlesCDPointControle = cPPointControlesCDPointControle;
    }

}
